function act_cell_multiTime(ExpGroup,cell,pl)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Displays activity trace with running, visual flow and perturbations
%   For 1 layer exp use only the first 2 arguments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tmp_data_dir = '\\KELLER-RIG1-ANA\RawData\';
adata_dir = '\\argon.fmi.ch\keller.g\AData\';
% l_win=1000;
% r_win=500;
for fnd=1:length(ExpGroup)
    display(['Exp: ' num2str(ExpGroup(fnd)) ' *****************************']);
    [adata_file,mouse_id,userID]=find_adata_file(ExpGroup(fnd),adata_dir);
    orig=load([adata_dir userID '\' mouse_id '\' adata_file],'ROIs','nbr_frames','aux_files');
    aux_data=[];
    try
        for ind=1:length(orig.aux_files)
            if exist([tmp_data_dir userID '\' mouse_id '\' orig.aux_files{ind}],'file');
                disp(['loading file ' orig.aux_files{ind} ' from local tmpdata directory']);
                curr_load_path=[tmp_data_dir userID '\' mouse_id '\' orig.aux_files{ind}];
            else
                disp(['loading file ' orig.aux_files{ind} ' from the network RawData directory']);
                curr_load_path=[rdata_dir userID '\' mouse_id '\' orig.aux_files{ind}];
            end
            
            tmp_data=load_lvd(curr_load_path);
            tmp_frames=get_frame_times(tmp_data(2,:));
            
            if orig.nbr_frames(ind)~=length(tmp_frames)
                if max(diff(tmp_frames))/median(diff(tmp_frames))<1.5 & length(tmp_frames)>orig.nbr_frames(ind)
                    disp('NC WARNING! Probably scanning too fast for FPGA to stop in the same frame')
                    disp(['--- ' num2str(length(tmp_frames)-orig.nbr_frames(ind)) ' frames too many ---'])
                    tmp_data(2,tmp_frames(orig.nbr_frames(ind)+1):end)=0;
                else
                    disp('CRITICAL WARNING! - aux data longer than it should be.')
                    %return
                    %tmp_data=tmp_data(:,1:tmp_frames(nbr_frames(ind)+1));
                    [~,last_bad_frame]=max(diff(tmp_frames));
                    tmp_data=tmp_data(:,ceil(mean([tmp_frames(last_bad_frame) tmp_frames(last_bad_frame+1)])):end);
                end
            end
            aux_data(:,end+1:end+length(tmp_data))=tmp_data;
        end
        
        frame_times=get_frame_times(aux_data(2,:));
        
        %         vars_to_assigin_base={vars_to_assigin_base{:}, 'aux_data', 'frame_times'};
    catch
        disp('Did not load aux data')
    end
    
%     idata=zeros(0,0,0,'uint8');
%     imeta_data=[];
%     no_eye_data=0;
%     for ind=1:length(orig.aux_files)
%         if exist([tmp_data_dir userID '\' mouse_id  '\' orig.aux_files{ind}(1:end-4) '.eye'],'file');
%             disp(['loading file ' orig.aux_files{ind}(1:end-4) '.eye' ' from local tmpdata directory']);
%             curr_load_path=[tmp_data_dir userID '\' mouse_id '\' orig.aux_files{ind}(1:end-4) '.eye'];
%         elseif exist([rdata_dir userID '\' mouse_id '\' orig.aux_files{ind}(1:end-4) '.eye'],'file');
%             disp(['loading file ' orig.aux_files{ind}(1:end-4) '.eye' ' from the network RawData directory']);
%             curr_load_path=[rdata_dir userID '\' mouse_id '\' orig.aux_files{ind}(1:end-4) '.eye'];
%         else
%             disp('No eye data found!')
%             no_eye_data=1;
%             break
%         end
%         [tmp_idata, tmp_imeta_data] = load_eye_monitor_data(curr_load_path,1);
%         orig.nbr_iframes(ind)=length(tmp_imeta_data);
%         if ind==1||sum(size(idata(:,:,1))==size(tmp_idata(:,:,1)))==2
%             idata(:,:,end+1:end+size(tmp_idata,3))=tmp_idata;
%         else
%             disp('Idata sizes don''t match - will improvise');
%             idata(1:size(tmp_idata,1),1:size(tmp_idata,2),end+1:end+size(tmp_idata,3))=tmp_idata;
%         end
%         
%         imeta_data(:,end+1:end+length(tmp_imeta_data))=tmp_imeta_data;
%     end
%     if ~no_eye_data
%         [iframe_times]=get_iframe_times(imeta_data,aux_data(1,:),orig.nbr_iframes);
%     end
%     try
%         [~, pupil_diam, pupil_pos, blink] = find_saccades(idata);
%     catch
%         1
%     end
%     tmp_pupil_diam=[];
%     tmp_pupil_pos=[];
%     tmp_blink=[];
%     [tmp_pupil_diam]=map_eye_data_to_aux(pupil_diam,iframe_times,length(aux_data));
%     [pupil_pos1]=map_eye_data_to_aux(pupil_pos(1,:),iframe_times,length(aux_data));
%     [pupil_pos2]=map_eye_data_to_aux(pupil_pos(2,:),iframe_times,length(aux_data));
%     tmp_pupil_pos(1,:)=pupil_pos1;
%     tmp_pupil_pos(2,:)=pupil_pos2;
%     [tmp_blink]=map_eye_data_to_aux(blink,iframe_times,length(aux_data));
    [pupil_diam,pupil_pos,blink,iframe_times]=load_eye_analysis(ExpGroup(fnd));
    cell_fig_vis2(orig.ROIs{pl}(cell).activity,aux_data,orig.nbr_frames,frame_times(pl:4:end),pupil_diam,pupil_pos,blink,iframe_times);
end

% ExpGroup=[3843;4015;4176;4285;4346;4395;4499];
% 
% ExpGroup=[3858;4033;4192;4327;4356;4402;4532];
% 
% ExpGroup=[4885;4975;5015;5031;5105;5287;5347];
